package com.skyline.wo.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

import com.skyline.wo.model.ShortMessage;

public class ShortMessageMapper  implements RowMapper<ShortMessage> {
	
	private static final ShortMessageMapper MAPPER = new ShortMessageMapper();
	
	public static ShortMessageMapper getMapper() {
		return MAPPER;
	}

	@Override
	public ShortMessage mapRow(ResultSet rs, int rowNum) throws SQLException {
		ShortMessage s = new ShortMessage();
		s.setCreateTime(rs.getTimestamp("createTime"));
		s.setId(rs.getLong("id"));
		//s.setImg(rs.getString("img"));
		s.setOwnerId(rs.getLong("ownerId"));
		s.setOwnerNickname(rs.getString("ownerNickname"));
		s.setOwnerPortrait(rs.getString("ownerPortrait"));
		
		s.setText(rs.getString("text"));
		//s.setVideo(rs.getString("video"));
		s.setComment(rs.getString("comment"));
		s.setSourceOwnerId(rs.getLong("sourceOwnerId"));
		s.setSourceOwnerNickname(rs.getString("sourceOwnerNickname"));
		
		return s;
	}
}
